package com.kly.user.db.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.google.common.collect.Maps;
import com.kly.user.db.dao.UserConversationRecordDao;
import com.kly.user.db.entity.UserConversationRecordEntity;
import com.kly.user.dto.UserConversationRecordDto;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* User: 11437
* Date: 2023-07-13
* Time: 11:22:28.605
*/

@Repository
public class UserConversationRecordDaoImpl extends AbstractBaseMapper<UserConversationRecordEntity> implements UserConversationRecordDao {

    @Override
    public List<UserConversationRecordEntity> getUserConversationList(Map<String, Object> params) {

        return this.getSqlSession().selectList(this.getStatement("getUserConversationList"), params);
    }


    @Override
    public List<UserConversationRecordEntity> getUserConversationMsgNum(Map<String, Object> params) {
        return this.getSqlSession().selectList(this.getStatement("getUserConversationMsgNum"), params);
    }

    @Override
    public UserConversationRecordEntity getUserConversation(String fromUserCode, String toUserCode, Integer conversationType) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("userCode", fromUserCode);
        params.put("toUserCode", toUserCode);
        params.put("conversationsType", conversationType);
        return this.getSqlSession().selectOne(this.getStatement("getUserConverSationRecord"), params);
    }
}